import React from 'react';
import { View, Image, Text, Button } from 'react-native';

class Cat extends React.Component {

  state = { isHungry: true }
  constructor(props) {
    super(props);
  }

  render() {
    return (
      <>
        <Image
          source={{
            uri: 'https://reactnative.dev/docs/assets/p_cat1.png'
          }}
          style={{ width: 200, height: 200 }}
        />
        <Text>Hello, I am {this.props.name} cat, and I am {this.state.isHungry ? ' hungry' : ' full'}. </Text>
        <Button
          onPress={() => {
            this.setState({ isHungry: false });
          }}
          disabled={!this.state.isHungry}
          title={
            this.state.isHungry ? "Pour me some milk, please" : "Thank you"
          }
        />
      </>
    );
  }
}

export default Cat;